/*
 * @Author: your name
 * @Date: 2020-08-26 14:12:08
 * @LastEditTime: 2020-08-26 14:17:33
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /decorator/index.ts
 */
function testDecorator () {
  return function<T extends new (...args: any[]) => any > (constructor: T){
    return class extends constructor {
      name = 'shawn';
      getName () {
        return this.name;
      }
    }
  }
}
const Test = testDecorator (){
  class {
    name: string;
    constructor(name: string){
      this.name = name;
    }
  }
}
const test = new Test('xiao');
console.log(test.getName())
